//
//  SYAddMembersView.m
//  SanYiTeaching
//
//  Created by 郑浩然 on 2019/4/22.
//  Copyright © 2019年 SanYi. All rights reserved.
//

#import "SYAddMembersView.h"
#import "SYFuntionHeaderView.h"
#import "SYTopLabView.h"

@interface SYAddMembersView ()

@property (strong, nonatomic) UILabel *headerLab;//小组名称
@property (strong, nonatomic) SYFuntionHeaderView *headerViewKS;//开始
@property (strong, nonatomic) SYFuntionHeaderView *headerViewJS;//结束
@property (strong, nonatomic) UIButton *chaxunBtn;//修改按钮
@property (strong, nonatomic) SYTopLabView *topLabView;//头
@property (strong, nonatomic) UIView *topBgView;//表
@property (strong, nonatomic) UIView *topTheerView;//二级
@end



@implementation SYAddMembersView

- (instancetype)init {
    self = [super init];
    if (self) {
        [self initSubView];
    }
    return self;
}

- (void)initSubView {
    [self addSubview:self.headerLab];
    [self.headerLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.top.equalTo(self.mas_top).offset(18);
    }];
    
    CGFloat height = 40;
    CGFloat width = 170;
    //开始日期
    [self addSubview:self.headerViewKS];
    [self.headerViewKS mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.headerLab.mas_bottom).offset(10);
        make.right.equalTo(self.mas_centerX).offset(-90);
        make.width.mas_equalTo(width);
        make.height.mas_equalTo(height);
    }];
    [self.headerViewKS.textField mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(115);
    }];
    [self.headerViewKS.xhxView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(115);
    }];
    
    //结束日期
    [self addSubview:self.headerViewJS];
    [self.headerViewJS mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.headerViewKS.mas_centerY);
        make.left.equalTo(self.mas_centerX).offset(30);
        make.width.mas_equalTo(width);
        make.height.mas_equalTo(height);
    }];
    [self.headerViewJS.textField mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(115);
    }];
    [self.headerViewJS.xhxView mas_updateConstraints:^(MASConstraintMaker *make) {
        make.width.mas_equalTo(115);
    }];
    
    [self addSubview:self.chaxunBtn];
    [self.chaxunBtn mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.headerViewKS.mas_centerY);
        make.left.equalTo(self.headerViewJS.mas_right).offset(60);
        make.width.mas_equalTo(75);
        make.height.mas_equalTo(30);
    }];
    //bgview
    [self addSubview:self.topBgView];
    [self.topBgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.mas_centerX);
        make.bottom.equalTo(self.mas_bottom).offset(0);
        make.left.equalTo(self.mas_left).offset(0);
        make.right.equalTo(self.mas_right).offset(0);
        make.height.mas_equalTo(40);
    }];
    //二级
    
    //头部
    [self.topBgView addSubview:self.topLabView];
    [self.topLabView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.equalTo(self.topBgView.mas_centerX);
        make.top.equalTo(self.topBgView.mas_top).offset(0);
        make.width.mas_equalTo(574);
        make.height.mas_equalTo(40);
    }];
    
    
    
}
//查询
- (void)chaxunBtnClick {
    
}


#pragma mark -
- (UILabel *)headerLab {
    if (!_headerLab) {
        _headerLab = [UILabel titleColour:TITLECOLOR
                               titleFount:14
                                 pingfang:@"PingFang-SC-Medium"
                                alignment:NSTextAlignmentCenter
                                titleLine:1];
        _headerLab.text = @"添加成员";
    }
    return _headerLab;
}
//开始日期
- (SYFuntionHeaderView *)headerViewKS {
    if (!_headerViewKS) {
        _headerViewKS = [[SYFuntionHeaderView alloc] init];
        _headerViewKS.titleLab.text = @"工号: ";
        _headerViewKS.contLab.hidden = YES;
        _headerViewKS.textField.placeholder = @"输入工号";
    }
    return _headerViewKS;
}
//结束日期
- (SYFuntionHeaderView *)headerViewJS {
    if (!_headerViewJS) {
        _headerViewJS = [[SYFuntionHeaderView alloc] init];
        _headerViewJS.titleLab.text = @"姓名: ";
        _headerViewJS.contLab.hidden = YES;
        _headerViewJS.textField.placeholder = @"输入姓名";
    }
    return _headerViewJS;
}
//修改
- (UIButton *)chaxunBtn {
    if (!_chaxunBtn) {
        _chaxunBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_chaxunBtn addTarget:self action:@selector(chaxunBtnClick) forControlEvents:UIControlEventTouchUpInside];
        _chaxunBtn.titleLabel.font = [UIFont systemFontOfSize:14];
        [_chaxunBtn setTitleColor:[UIColor colorWithHexString:@"#20B097"] forState:0];
        [_chaxunBtn setTitle:@"查询" forState:UIControlStateNormal];
        _chaxunBtn.layer.borderWidth = .5;
        _chaxunBtn.layer.borderColor = [UIColor colorWithHexString:@"#20B097"].CGColor;
        _chaxunBtn.layer.masksToBounds = YES;
        _chaxunBtn.layer.cornerRadius = 5;
    }
    return _chaxunBtn;
}
- (SYTopLabView *)topLabView {
    if (!_topLabView) {
        NSArray *xiaoArr = @[@"工号",@"姓名",@"性别",@"手机号",@"添加"];
        _topLabView = [[SYTopLabView alloc] initWithDataNameArr:xiaoArr width:0.2];
    }
    return _topLabView;
}
//头
- (UIView *)topBgView {
    if (!_topBgView) {
        _topBgView = [[UIView alloc] init];
        _topBgView.backgroundColor = [UIColor colorWithHexString:@"#F8F8F8"];
    }
    return _topBgView;
}
//二级
- (UIView *)topTheerView {
    if (_topTheerView) {
        _topTheerView = [[UIView alloc] init];
    }
    return _topTheerView;
}

@end















